<?php
include "includes/comunes.php";
if (!function_exists('json_encode')) {
	require_once 'json/jsonwrapper_inner.php';
}
$q = strtolower($_POST["dni"]);
if (!$q) return; //si no nos trae nada retornamos
$cadena = trim($q); //le asignamos a cadena $Q sin espacios
$tabla="personas";
$condicion=" personaDniCuit =".$cadena;
$orden=" order by personaNombre";
$select=cons_sql($tabla, $condicion, $orden);
 if(mysql_num_rows($select)>0):
     $reg=  mysql_fetch_array($select);
 endif
?>
 
           <fieldset>
              <legend><b>Datos del Vendedor</b></legend> 
               <table width="100%">
                 <tr>
                     <input type="hidden" class="campo_form"  id="usualta" name="usualta" value="0">
                     <input type="hidden" class="campo_form"  id="personaId" name="personaId" value="<?php echo $reg['personaId']?>">
                      <td class="textotablamenuform">Tipo</td>
                      <td class="textotablamenuform">
                          <select name="ventipo" id="ventipo" class="campo_form" required>
                              <?php if($reg['personaNombre']==1):?>
                              <option value='1' selected>Persona Fisica</option>
                                <?php else:?>
                               <option value='1'>Persona Fisica</option>
                               <?php endif?>
                              <?php if($reg['personaNombre']==2):?>
                              <option value='2' selected>Persona Juridica</option>
                              <?php else:?>
                               <option value='2'>Persona Juridica</option>
                                <?php endif?>
                         </select>
                      </td>
                      <td class="textotablamenuform">Dni/Cuit</td>
                      <td class="textotablamenuform">
                           <input type="number" class="campo_form" autocomplete="on" placeholder="Ej. 28992993" id="vendni" name="vendni" value="<?php echo utf8_encode($cadena)?>" required>
                    
                      </td>
                      
                 </tr>
                 <tr>
                     <td class="textotablamenuform">Nombre y Apellido</td>
                      <td class="textotablamenuform" colspan="5">
                          <input type="text" class="campo_form"  id="venape" name="venape" value="<?php echo utf8_encode($reg['personaNombre'])?>" required>
                    
                      </td>
                 </tr>
                   <tr>
                      <td class="textotablamenuform">Telefono Fijo</td>
                      <td class="textotablamenuform">
                          <input type="number" class="campo_form" placeholder="Ej. 03624 764244" id="ventelf" name="ventelf" value="<?php echo utf8_encode($reg['personaTelefonoFijo'])?>">
                    
                      </td>
                      <td class="textotablamenuform">Telefono Celular</td>
                      <td class="textotablamenuform">
                          <input type="number" class="campo_form" placeholder="Ej. 0362 154764244" id="ventelc" name="ventelc" value="<?php echo utf8_encode($reg['personaTelefonoCelular'])?>">
                    
                      </td>
                      
                 </tr>
                   <tr>
                      
                      <td class="textotablamenuform">Direccion</td>
                      <td class="textotablamenuform" colspan="2">
                           <input type="text" class="campo_form"  id="venape" name="vendir" required value="<?php echo utf8_encode($reg['personaDireccion'])?>">               
                      </td>
					  
                 </tr>
                   <tr>
				 <td class="textotablamenuform">
				 Observacion
				 </td>
				 <td colspan="4">
				 <textarea name="venObse" cols="65" class="campo_form"></textarea>
				 </td>
				 </tr>
                   
                   
               </table>    
           </fieldset>  
    